#!/bin/bash

help() {
  uptime -h
}

core() {
  if [[ $# -eq 0 ]]; then
    uptime
    exit 0
  fi

  while [[ $# -gt 0 ]]; do
    local key=$1
    local value=$2
    case $key in
    -h | --help)
      help
      exit 0
      ;;
    *)
      echo "ERROR: unknown parameter \"$key\""
      help
      exit 1
      ;;
    esac
  done
}

run() {
  core $@
}

run $@
